package com.entity;

import lombok.Data;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;

import javax.annotation.Resource;

@Data //setter/getter/toString/equals/hashCode

public class Person {

    private String name; //姓名
    private String gender; //性别
    private String birthday; //出生日期
    private String address; //住址

    @Resource(name="car3")
    //@Autowired  //默认按照类型来注入。
    //@Qualifier("car3")  //@Autowired+@Qualifier == @Resource
    private Car car; //拥有的车


    public Person() {
        System.out.println("一个人从世界上诞生了...");
    }

    public Person(String name, String gender, String birthday, String address, Car car) {
        System.out.println("执行了Person带五个参数的构造方法...");
        this.name = name;
        this.gender = gender;
        this.birthday = birthday;
        this.address = address;
        this.car = car;
    }

    public Person(String name, String gender, String birthday, String address) {
        this.name = name;
        this.gender = gender;
        this.birthday = birthday;
        this.address = address;
    }
}
